package com.atguigu.springcloud.alibaba.controller.singleton.Singleton03;

import com.atguigu.springcloud.alibaba.controller.singleton.Singleton03.Singleton;

/**
 * @Author: Fanw
 * @Date: 2021/4/22 18:07
 * @Description:
 */
public class SingletonTest03 {
    public static void main(String[] args) {
        System.out.println("懒汉式 1 ， 线程不安全~");
        Singleton instance = Singleton.getInstance();
        Singleton instance2 = Singleton.getInstance();
        System.out.println(instance == instance2); // true
        System.out.println("instance.hashCode=" + instance.hashCode());
        System.out.println("instance2.hashCode=" + instance2.hashCode());

    }

}
